package com.woniu.adminservice.service.impl;

import com.woniu.adminservice.entity.ManagerAccount;
import com.woniu.adminservice.dao.ManagerAccountDao;
import com.woniu.adminservice.service.ManagerAccountService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("managerAccountService")
public class ManagerAccountServiceImpl implements ManagerAccountService {
    @Resource
    private ManagerAccountDao managerAccountDao;

    @Override
    public ManagerAccount queryById(Integer id) {
        return managerAccountDao.queryById(id);
    }

    @Override
    public List<ManagerAccount> queryAllByLimit(int offset, int limit) {
        return managerAccountDao.queryAllByLimit(offset, limit);
    }
   
     @Override
    public List<ManagerAccount> findAll() {
        return managerAccountDao.findAll();
    }

    @Override
    public ManagerAccount insert(ManagerAccount managerAccount) {
        managerAccountDao.insert(managerAccount);
        return managerAccount;
    }

    @Override
    public ManagerAccount update(ManagerAccount managerAccount) {
        managerAccountDao.update(managerAccount);
        return queryById(managerAccount.getId());
    }

    @Override
    public boolean deleteById(Integer id) {
        return managerAccountDao.deleteById(id) > 0;
    }
}